package com.yao.springcachedemo.config;

import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;

import java.util.HashSet;

/**
 * @author yao
 */
@Configuration
public class RedisCacheConfig {
    @Bean("redisCacheManager")
    public CacheManager redisCacheManage(RedisConnectionFactory redisConnectionFactory) {
        return RedisCacheManager.builder(redisConnectionFactory)
                .withCacheConfiguration("user",RedisCacheConfiguration.defaultCacheConfig())
                .build();
    }


}
